package com.onlineMIS.ORM.entity.headQ.finance;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.onlineMIS.ORM.entity.base.BaseOrder;
import com.onlineMIS.ORM.entity.headQ.finance.FinanceBill.FinanceBillItemSort;
import com.onlineMIS.ORM.entity.headQ.user.UserInfor;
import com.onlineMIS.common.Common_util;

public class ExpenseHq extends BaseOrder {
	
	public static final int DOCUMENT_TYPE_HQ_COST =0;//总部费用单据
	public static final int DOCUMENT_TYPE_HQ_INCOME =1;//总部收益单据
	{
		typeHQMap.put(DOCUMENT_TYPE_HQ_COST, "总部费用单据");  //总部费用单据
		typeHQMap.put(DOCUMENT_TYPE_HQ_INCOME, "总部收益单据	");//总部收益单据	
	}
	private int id;
	
	private int entityId;

	private FinanceCategory financeCategory;
	
	private double amount;

	private String comment;
	
	private UserInfor user;
	
	private Date expenseDate = new Date();
	
	private Date createDate;
	
	private Date lastUpdateDate;
	
	protected Map<Integer, String> typeMap = new LinkedHashMap<Integer, String>();
	{
		typeMap.put(ExpenseHq.DOCUMENT_TYPE_HQ_COST, "费用单据");
		typeMap.put(ExpenseHq.DOCUMENT_TYPE_HQ_INCOME, "收益单据");
	}
	
	private Set<ExpenseHqItem> expenseHqItemSet = new HashSet<ExpenseHqItem>();
	private List<ExpenseHqItem> list = new ArrayList<ExpenseHqItem>();

	
	
	public Set<ExpenseHqItem> getExpenseHqItemSet() {
		return expenseHqItemSet;
	}

	public void setExpenseHqItemSet(Set<ExpenseHqItem> expenseHqItemSet) {
		this.expenseHqItemSet = expenseHqItemSet;
	}

	public ExpenseHq() {
		
	}

	public int getEntityId() {
		return entityId;
	}

	public void setEntityId(int entityId) {
		this.entityId = entityId;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}


	public FinanceCategory getFinanceCategory() {
		return financeCategory;
	}

	public void setFinanceCategory(FinanceCategory financeCategory) {
		this.financeCategory = financeCategory;
	}

	public double getAmount() {
		return amount;
	}

	public void setAmount(double amount) {
		this.amount = amount;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public UserInfor getUser() {
		return user;
	}

	public void setUser(UserInfor user) {
		this.user = user;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getExpenseDate() {
		return expenseDate;
	}

	public void setExpenseDate(Date expenseDate) {
		this.expenseDate = expenseDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Date lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public List<ExpenseHqItem> getList() {
		return list;
	}

	public void setList(List<ExpenseHqItem> list) {
		this.list = list;
	}
	
	
	
	public Map<Integer, String> getTypeMap() {
		return typeMap;
	}

	public void setTypeMap(Map<Integer, String> typeMap) {
		this.typeMap = typeMap;
	}

	public void putListToSet(){
		if (list != null)
			for (int i = 0; i < list.size(); i++){
				if (list.get(i)!= null && list.get(i).getExpenseHqType() != null){
					ExpenseHqItem item = list.get(i);
					item.setExpenseHq(this);
				    expenseHqItemSet.add(item);
				}
			}
	}
	
    public void putSetToList(){
		if (expenseHqItemSet != null){
			for (Iterator<ExpenseHqItem> billItem_Iterator = expenseHqItemSet.iterator();billItem_Iterator.hasNext();){
				list.add(billItem_Iterator.next());
			}
		}
    }
	
	
}
